package com.xyht.medicine_management_system.common.util;

import org.apache.commons.lang3.ArrayUtils;

import java.util.List;

public class ParamCheckUtil {
    public static boolean isNullOrEmpty (Object object){
        if (object == null){
            return true;
        }
        if (object instanceof String){
            if (((String) object).isEmpty()){
                return true;
            }
        }
        return false;
    }

    public static boolean isNullOrEmpty(Object... objects) {
        for (Object object : ArrayUtils.nullToEmpty(objects)) {
            if (object == null) {
                return true;
            }
            if (object instanceof String) {
                if (((String) object).isEmpty()) {
                    return true;
                }
            } else if (object instanceof List) {
                if (((List<?>) object).isEmpty()) {
                    return true;
                }
            }
        }
        return false;
    }

}
